import 'package:agora_rtc_engine/rtc_engine.dart';
import 'package:star_author/utils/utils.dart';
import 'package:star_author/views/stream/model/live_good_list_entity.dart';
import 'package:star_author/widgets/button_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

class CalculateValuationDialog extends StatefulWidget {
  LiveGoodListData data;
  Map select_reference;
  String searchText;
  Map studioDetail;
  late RtcEngine? engine;
  Function? muteCallBack;
  CalculateValuationDialog({
    Key? key,
    required this.select_reference,
    required this.searchText,
    required this.studioDetail,
    required this.engine,
    required this.muteCallBack,
    required this.data,
  }) : super(key: key);

  @override
  State<CalculateValuationDialog> createState() =>
      _CalculateValuationDialogState();
}

class _CalculateValuationDialogState extends State<CalculateValuationDialog> {
  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisSize: MainAxisSize.min, //居中  并且是最小布局  可以点击遮罩层
      //Material外面可以使用组件 不能有样式
      mainAxisAlignment: MainAxisAlignment.spaceAround,
      children: [
        Material(
          color: Colors.transparent,
          child: Center(
            child: Container(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.spaceAround,
                mainAxisSize: MainAxisSize.min,
                children: [
                  Container(
                    decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.circular(8.w),
                    ),
                    height: 164.w,
                    width: Get.width,
                    alignment: Alignment.center,
                    margin: EdgeInsets.symmetric(
                      horizontal: 20.w,
                    ),
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      mainAxisAlignment: MainAxisAlignment.center,
                      mainAxisSize: MainAxisSize.min,
                      children: [
                        buildTitle(),
                        ButtonWidget(
                          child: Text(
                            "知道了",
                            style: TextStyle(
                              fontSize: 16.sp,
                              color: Colors.white,
                              fontWeight: FontWeight.w500,
                            ),
                          ),
                          type: ButtonType.bgOrange,
                          height: 40,
                          onPressed: () {
                            Get.back();
                          },
                        ),
                      ],
                    ),
                  )
                ],
              ),
              margin: EdgeInsets.symmetric(horizontal: 50.w),
              decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(8), color: Colors.white),
            ),
          ),
        )
      ],
    );
  }

  buildTitle() {
    return Column(
      children: [
        Text(
          '最终估价',
          style: TextStyle(
            fontSize: 14.sp,
            color: rgba(51, 51, 51, 1),
            fontWeight: FontWeight.w500,
          ),
        ),
        SizedBox(
          height: 10.w,
        ),
        Text(
          getPriceWithList(
            widget.data.priceRange ?? [],
            intl: true,
          ),
          style: TextStyle(
            fontSize: 18.sp,
            color: rgba(224, 32, 32, 1),
            fontWeight: FontWeight.w500,
          ),
        ),
        SizedBox(
          height: 22.w,
        ),
      ],
    );
  }
}
